package com.ndp.fb.model.fbagent.param.serach;

/**
 * Created by infi on 2015/1/21.
 */
public enum SearchType {
    /**
     * adlocale
     */
    ADLOCALE(1, "adlocale"),

    /**
     * adinterest
     */
    ADINTEREST(2, "adinterest"),

    /**
     * adInterestCategory
     */
    ADINTERESTCATEGORY(3, "adInterestCategory"),

    /**
     * adcountry
     */
    ADCOUNTRY(4, "adcountry"),

    /**
     * behaviors  ADD BY EVAN 2015-01-27
     */
    ADTARGETINGCATEGORY(5, "adTargetingCategory"),
    /**
     * ADESTINATION  ADD BY GISER 2015-05-29
     */
    ADDESTINATION(6, "adDestination");

    /**
     * type
     */
    private int index;

    /**
     * type
     */
    private String type;

    /**
     * 私有构造方法
     *
     * @param type type
     */
    private SearchType(int index, String type) {
        this.index = index;
        this.type = type;
    }


    /**
     * 根据type获取Status
     * @param type type
     * @return Status
     */
    public static SearchType getSearchType(String type) {
        for (SearchType c : SearchType.values()) {
            if (c.type.equals(type)) {
                return c;
            }
        }

        return null;
    }

    /**
     * 根据type获取Status
     * @param index index
     * @return Status
     */
    public static SearchType getSearchType(int index) {
        for (SearchType c : SearchType.values()) {
            if (c.index == index) {
                return c;
            }
        }

        return null;
    }

    /**
     * @author Administrator
     * 创建时间 2014年2月28日 下午2:31:14
     * @return type
     */

    public String getType() {
        return type;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public void setType(String type) {
        this.type = type;
    }
}
